using System;
using Newtonsoft.Json;

namespace FBGraph.Models
{
    /// <summary>A link shared on a user's wall</summary>
    /// <remarks>
    /// <para>Example: https://graph.facebook.com/114961875194024 (A link shared by Arjun Banker)</para>
    /// </remarks>
    /// <para>Example: https://graph.facebook.com/19292868552_118464504835613 (A post from Facebook Platform)</para>
    public partial class Post : IFBGraphResult
    {
        /// <summary>The status message ID</summary>
        [JsonPropertyAttribute("id")]
        public String Id { get; set; }
        
        /// <summary>An object containing the name and ID of the user who posted the link</summary>
        [JsonPropertyAttribute("from")]
        public From From { get; set; }
        
        /// <summary>The optional message from the user about this link</summary>
        [JsonPropertyAttribute("message")]
        public String Message { get; set; }
        
        /// <summary>If available, a link to the picture included with this post</summary>
        [JsonPropertyAttribute("picture")]
        public String Picture { get; set; }
        
        /// <summary>The actual URL that was shared</summary>
        [JsonPropertyAttribute("link")]
        public String Link { get; set; }
        
        /// <summary>The name of the link</summary>
        [JsonPropertyAttribute("name")]
        public String Name { get; set; }
        
        /// <summary>The caption of the link (appears beneath the link name)</summary>
        [JsonPropertyAttribute("caption")]
        public String Caption { get; set; }
        
        /// <summary>A link to an icon representing the type of this post</summary>
        [JsonPropertyAttribute("icon")]
        public String Icon { get; set; }
        
        /// <summary>A list of available action names and links (including commenting, liking, and an optional app-specified action)</summary>
        [JsonPropertyAttribute("actions")]
        public PostAction[] Actions { get; set; }
        
        /// <summary>The type of the post (link, photo, status update, etc)</summary>
        [JsonPropertyAttribute("type")]
        public String Type { get; set; }
        
        /// <summary>The time the post was initially published</summary>
        [JsonPropertyAttribute("created_time")]
        public DateTime CreatedTime { get; set; }
        
        /// <summary>The time the message was published</summary>
        [JsonPropertyAttribute("updated_time")]
        public Nullable<DateTime> UpdatedTime { get; set; }
        
        /// <summary>A string indicating which application was used to create this post</summary>
        [JsonPropertyAttribute("attribution")]
        public String Attribution { get; set; }
        
        /// <summary>A <see cref="PagedResult{Comment}" /> collection of comments about the post</summary>
        [JsonPropertyAttribute("comments")]
        public PagedResult<Comment> Comments { get; set; }
        
        /// <summary>The number of likes on this post</summary>
        [JsonPropertyAttribute("likes")]
        public Int64 Likes { get; set; }
        
        /// <summary>A description of the link (appears beneath the link caption)</summary>
        [JsonPropertyAttribute("description")]
        public String Description { get; set; }
        
        /// <summary>A <see cref="PostPrivacy" /> object describing the author-specified privacy settings for the post</summary>
        [JsonPropertyAttribute("privacy")]
        public PostPrivacy Privacy { get; set; }
        
        /// <summary>A list of the profiles mentioned or targeted in this post</summary>
        [JsonPropertyAttribute("to")]
        public PagedResult<To> To { get; set; }
        
        /// <summary>If available, the source link attached to this post (for example, a flash or video file)</summary>
        [JsonPropertyAttribute("source")]
        public String Source { get; set; }
        
        /// <summary>Gets or sets a <see cref="Boolean" /> value representing whether the object has been populated.</summary>
        Boolean IFBGraphResult.IsReady { get; set; }
        
        /// <summary>Updates the current model with values from another like-typed model.</summary>
        /// <param name="other">The source model.</param>
        /// <remarks>This is used for asynchronous calls to update the reference that was returned when the original API method was called.</remarks>
        void IFBGraphResult.UpdateFrom(IFBGraphResult other)
        {
            var that = other as Post;
            if (that == null) return;
            else
            {
                this.Id = that.Id;
                this.From = that.From;
                this.Message = that.Message;
                this.Picture = that.Picture;
                this.Link = that.Link;
                this.Name = that.Name;
                this.Caption = that.Caption;
                this.Icon = that.Icon;
                this.Actions = that.Actions;
                this.Type = that.Type;
                this.CreatedTime = that.CreatedTime;
                this.UpdatedTime = that.UpdatedTime;
                this.Attribution = that.Attribution;
                this.Comments = that.Comments;
                this.Likes = that.Likes;
                this.Description = that.Description;
                this.Privacy = that.Privacy;
                this.To = that.To;
                this.Source = that.Source;
                ((IFBGraphResult)this).IsReady = true;
            }
            
        }
        
        /// <summary>Contains information about an action that was included in a <see cref="Post" /></summary>
        public partial class PostAction
        {
            /// <summary>The name of the action</summary>
            [JsonPropertyAttribute("name")]
            public String Name { get; set; }
            
            /// <summary>The URL for the action</summary>
            [JsonPropertyAttribute("link")]
            public String Link { get; set; }
        }
        
        
        /// <summary>Contains information about privacy settings for a <see cref="Post" /></summary>
        public partial class PostPrivacy
        {
            /// <summary>The human-readable description of the privacy setting</summary>
            [JsonPropertyAttribute("description")]
            public String Description { get; set; }
            
            /// <summary>The privacy value</summary>
            [JsonPropertyAttribute("value")]
            public String Value { get; set; }
        }
    }
}